<?php
$config = [
    'name'       => 'Feehi CMS',
    'version'    => '2.0.5.1',
    'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
    'aliases'    => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
    ],
    'bootstrap'  => [
        'queue', // 把这个组件注册到控制台
    ],
    'components' => [

        'queue' => [
            'class'   => \yii\queue\redis\Queue::className(),
            'as log'  => \yii\queue\LogBehavior::className(),//错误日志 默认为 console/runtime/logs/app.log
            'redis'   => 'redis', // 连接组件或它的配置
            'channel' => 'queue', // Queue channel key
        ],
        'smser' => [ //短信sms
            // 云片网
            'class'    => 'daixianceng\smser\YunpianSmser',
            //天拉拉
            'apikey'   => '7c68d9f9c460421ce1cad35d2f6d3869',
            //测试
//            'apikey'   => '98e19636cbb3f7494bea621428ac327a',
            'fileMode' => false
        ],
        'excel' => [
            'class' => 'illusion\excel\Spreadsheet',
        ],
        'db'    => [//数据库配置，这里的配置可能会被conf/db.local main-local.php配置覆盖
            'class' => yii\db\Connection::className(),
            'dsn' => 'mysql:host=localhost;dbname=cms',
            'username' => 'root',
            'password' => 'root',
            'charset' => 'utf8mb4',
        ],
        'cdn'   => [//支持使用 七牛 腾讯云 阿里云 网易云 具体配置请参见 http://doc.feehi.com/cdn.html
            'class' => feehi\cdn\DummyTarget::className(),//不使用cdn
        ],
        'cache' => [//缓存组件 具体配置请参考 http://doc.feehi.com/configs.html
            'class' => yii\caching\DummyCache::className(),//不使用缓存
        ],
        'formatter' => [//格式显示配置
            'dateFormat'        => 'php:Y-m-d',
            'decimalSeparator'  => ',',
            'thousandSeparator' => ' ',
            'currencyCode'      => 'CHY',
            'nullDisplay'       => '-',
            'datetimeFormat'    => "php:Y-m-d H:i:s"
        ],
        'mailer' => [//邮箱发件人配置，会被main-local.php以及后台管理页面中的smtp配置覆盖
            'class' => yii\swiftmailer\Mailer::className(),
            'viewPath' => '@common/mail',
            'useFileTransport' => true,//false发送邮件，true只是生成邮件在runtime文件夹下，不发邮件
            'transport' => [
                'class'      => 'Swift_SmtpTransport',
                'host'       => 'smtp.163.com',  //每种邮箱的host配置不一样
                'username'   => 'sunjinhui167@163.com',
                'password'   => '572286594abc',
                'port'       => '586',
                'encryption' => 'tls',
            ],
            'messageConfig' => [
                'charset' => 'UTF-8',
                'from'    => ['sunjinhui167@163.com' => 'Tianlala robot ']
            ],
        ],
        'feehi' => [
            'class' => feehi\components\Feehi::className(),
        ],
        'authManager' => [
            'class' => yii\rbac\DbManager::className(),
        ],
        'assetManager' => [
            'linkAssets' => false,
            'bundles' => [
                yii\widgets\ActiveFormAsset::className() => [
                    'js' => [
                        'a' => 'yii.activeForm.js'
                    ],
                ],
                yii\bootstrap\BootstrapAsset::className() => [
                    'css' => [],
                    'sourcePath' => null,
                ],
                yii\captcha\CaptchaAsset::className() => [
                    'js' => [
                        'a' => 'yii.captcha.js'
                    ],
                ],
                yii\grid\GridViewAsset::className() => [
                    'js' => [
                        'a' => 'yii.gridView.js'
                    ],
                ],
                yii\web\JqueryAsset::className() => [
                    'js' => [
                        'a' => 'jquery.js'
                    ],
                ],
                yii\widgets\PjaxAsset::className() => [
                    'js' => [
                        'a' => 'jquery.pjax.js'
                    ],
                ],
                yii\web\YiiAsset::className() => [
                    'js' => [
                        'a' => 'yii.js'
                    ],
                ],
                yii\validators\ValidationAsset::className() => [
                    'js' => [
                        'a' => 'yii.validation.js'
                    ],
                ],
            ],
        ],
    ],
];
$install = Yii::getAlias('@common/config/conf/db.php');
if( file_exists($install) ){
    return yii\helpers\ArrayHelper::merge($config, (require $install));
}
return $config;